<template>
  <div class="d-flex flex-column my-container p-3">
    <el-form ref="form" :model="addScreenForm" :inline="true" class="d-flex justify-content-start">
      <el-form-item style="margin-left: 5px; margin-right: 20px">
        <el-button type="success" @click="returnUrl()">返回</el-button>
      </el-form-item>
      <el-form-item label="大屏标题">
        <el-input type="input" placeholder="请输入大屏标题" v-model="addScreenForm.visualizationName"/>
      </el-form-item>
      <el-form-item label="上传图片">
        <el-upload
          :headers="headers"
          class="avatar-uploader"
          :accept="'image/jpeg,image/png'"
          :before-upload="beforeUpload"
          :action="$uploadUrl + upload"
          :show-file-list="false"
          :on-success="handleLicenseSuccess"
          v-model="addScreenForm.downPic"
        >
          <img v-if="addScreenForm.downPic" :src="addScreenForm.downPic" class="imgCla"
               style="display: inline-block; width: 50px; height: 30px; vertical-align: middle"/>
          <i v-else class="el-icon-plus avatar-uploader-icon" style="width: 50px; height: 30px"></i>
        </el-upload>
      </el-form-item>
      <!--       style="margin-left: 200px;"-->
      <el-form-item style="margin-left: 50px">
        <el-button type="primary" @click="addClick" v-if="configCode == ''">保存</el-button>
      </el-form-item>
    </el-form>

    <div class="col d-flex flex-column shadow rounded-lg bg" style="height: 92%">
      <div class="d-flex screen_content">
        <div class="left">
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("one") ? setId.one.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('one')"
                   :src="require('@/assets/img/setting/' + setId.one.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('one') ? true : false"
                @click="openConfigDialog('one', 'leftRight', 1)"
              >配置
              </el-button>
            </div>
          </div>
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("two") ? setId.two.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('two')"
                   :src="require('@/assets/img/setting/' + setId.two.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('two') ? true : false"
                @click="openConfigDialog('two', 'leftRight', 2)"
              >配置
              </el-button>
            </div>
          </div>
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("three") ? setId.three.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('three')"
                   :src="require('@/assets/img/setting/' + setId.three.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('three') ? true : false"
                @click="openConfigDialog('three', 'leftRight', 3)"
              >配置
              </el-button>
            </div>
          </div>
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("four") ? setId.four.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('four')"
                   :src="require('@/assets/img/setting/' + setId.four.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('four') ? true : false"
                @click="openConfigDialog('four', 'leftRight', 4)"
              >配置
              </el-button>
            </div>
          </div>
        </div>
        <div class="center">
          <div class="center_top">
            <img v-if="setId.hasOwnProperty('eleven')"
                 :src="require('@/assets/img/setting/' + setId.eleven.picCode + '.jpg')" alt="" class="my_img"/>
            <el-button
              class="setBut"
              size="small"
              type="primary"
              v-if="type == 0 ? true : setId.hasOwnProperty('eleven') ? (setId.eleven.picCode == 'ZJ_HEAD_TWO' ? false : true) : false"
              @click="openConfigDialog('eleven', 'topSides', 11)"
            >配置
            </el-button>
          </div>
          <div v-if="addScreenForm.visualizationType == 1" class="center_content d-flex">
            <div class="centerContentItem mr">
              <div class="title">{{ setId.hasOwnProperty("twelve") ? setId.twelve.name : "" }}</div>
              <div class="configContent">
                <img v-if="setId.hasOwnProperty('twelve')"
                     :src="require('@/assets/img/setting/' + setId.twelve.picCode + '.jpg')" alt="" class="my_img"/>
                <el-button
                  class="setBut"
                  size="small"
                  type="primary"
                  v-if="type == 0 ? true : setId.hasOwnProperty('twelve') ? true : false"
                  @click="openConfigDialog('twelve', 'centerTop', 12)"
                >配置
                </el-button>
              </div>
            </div>
            <div class="centerContentItem">
              <div class="title">{{ setId.hasOwnProperty("thirteen") ? setId.thirteen.name : "" }}</div>
              <div class="configContent">
                <img v-if="setId.hasOwnProperty('thirteen')"
                     :src="require('@/assets/img/setting/' + setId.thirteen.picCode + '.jpg')" alt="" class="my_img"/>
                <el-button
                  class="setBut"
                  size="small"
                  type="primary"
                  v-if="type == 0 ? true : setId.hasOwnProperty('thirteen') ? true : false"
                  @click="openConfigDialog('thirteen', 'centerTop', 13)"
                >配置
                </el-button>
              </div>
            </div>
          </div>
          <div class="center_content d-flex">
            <div class="centerContentItem mr">
              <div class="title">{{ setId.hasOwnProperty("nine") ? setId.nine.name : "" }}</div>
              <div class="configContent">
                <img v-if="setId.hasOwnProperty('nine')"
                     :src="require('@/assets/img/setting/' + setId.nine.picCode + '.jpg')" alt="" class="my_img"/>
                <el-button class="setBut" size="small" type="primary" v-if="type != 1"
                           @click="openConfigDialog('nine', 'centerBottom', 9)">配置
                </el-button>
              </div>
            </div>
            <div class="centerContentItem">
              <div class="title">{{ setId.hasOwnProperty("ten") ? setId.ten.name : "" }}</div>
              <div class="configContent">
                <img v-if="setId.hasOwnProperty('ten')"
                     :src="require('@/assets/img/setting/' + setId.ten.picCode + '.jpg')" alt="" class="my_img"/>
                <el-button class="setBut" size="small" type="primary" v-if="type != 1"
                           @click="openConfigDialog('ten', 'centerBottom', 10)">配置
                </el-button>
              </div>
            </div>
          </div>
        </div>
        <div class="right">
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("five") ? setId.five.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('five')"
                   :src="require('@/assets/img/setting/' + setId.five.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('five') ? true : false"
                @click="openConfigDialog('five', 'leftRight', 5)"
              >配置
              </el-button>
            </div>
          </div>
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("six") ? setId.six.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('six')"
                   :src="require('@/assets/img/setting/' + setId.six.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('six') ? true : false"
                @click="openConfigDialog('six', 'leftRight', 6)"
              >配置
              </el-button>
            </div>
          </div>
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("seven") ? setId.seven.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('seven')"
                   :src="require('@/assets/img/setting/' + setId.seven.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('seven') ? true : false"
                @click="openConfigDialog('seven', 'leftRight', 7)"
              >配置
              </el-button>
            </div>
          </div>
          <div class="boxItem">
            <div class="title">{{ setId.hasOwnProperty("eight") ? setId.eight.name : "" }}</div>
            <div class="configContent">
              <img v-if="setId.hasOwnProperty('eight')"
                   :src="require('@/assets/img/setting/' + setId.eight.picCode + '.jpg')" alt="" class="my_img"/>
              <el-button
                class="setBut"
                size="small"
                type="primary"
                v-if="type == 0 ? true : setId.hasOwnProperty('eight') ? true : false"
                @click="openConfigDialog('eight', 'leftRight', 8)"
              >配置
              </el-button>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 更新布局弹框 -->
    <yc-dialog ref="ycDialog" dialogTitle="更新布局" centerTitle="更新布局" :showCenter="false" @close="onClose" v-draggable>
      <template #content>
        <div class="dialog-content">
          <el-form ref="screenFormRef" :rules="screenRules" :model="screenForm" label-width="70px">
            <el-form-item label="输入名称" prop="">
              <el-input v-model="screenForm.name" placeholder="请输入名称"/>
            </el-form-item>
          </el-form>
          <el-row :gutter="20" class="mt-2" style="max-height: 45vh; overflow-y: auto">
            <el-col :span="showList[0].id == 22 ? 24 : 8" v-for="(item, index) in showList" :key="item.id"
                    class="mb-2 text-center">
              <img :src="require('@/assets/img/setting/' + item.code + '.jpg')" alt=""
                   style="width: 100%; height: 164px" @click="screenForm.picCode = item.code"/>
              <el-radio v-model="screenForm.picCode" :label="item.code" class="mt-1"></el-radio>
            </el-col>
          </el-row>
        </div>
      </template>
      <template #footer>
        <el-button type="primary" @click="configBtn">保存</el-button>
        <el-button @click="onClose">取消</el-button>
      </template>
    </yc-dialog>

    <!-- 更新参数弹框类型一 -->
    <el-dialog ref="oneDialog" title="配置" :close-on-click-modal="false" :visible.sync="oneVisible" append-to-body
               @close="onClose" class="my_dialog"
               v-draggable>
      <div class="dialog-content">
        <div class="d-flex justify-content-end">
          <el-button type="primary" icon="el-icon-plus" @click="addItem">添加</el-button>
        </div>
        <el-table :data="oneList" border class="mt-4" height="40vh" ref="oneTable">
          <el-table-column prop="deviceName" label="设备名称" align="center"></el-table-column>
          <el-table-column prop="deviceCode" label="设备编码" align="center"></el-table-column>
          <el-table-column prop="parameterName" label="参数名称" align="center"></el-table-column>
          <el-table-column prop="parameterCode" label="参数代码" align="center"></el-table-column>
          <el-table-column label="操作" align="center">
            <template #default="{ row }">
              <el-button type="danger" size="mini" @click="onDel(row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="onSave">保存</el-button>
        <el-button @click="oneVisible = false">取消</el-button>
      </span>
    </el-dialog>

    <el-dialog ref="dataDialog" title="配置" :close-on-click-modal="false" :visible.sync="dialogVisible" @close="onClose"
               append-to-body
               class="my_dialog" v-draggable>
      <div class="dialog-content">
        <el-form ref="form" :model="form" label-width="70px" class="d-flex flex-wrap mt-2">
          <el-form-item label="选择设备" prop="deviceVal">
            <el-select v-model="form.deviceVal" placeholder="请选择" class="mr-4" @change="getList()">
              <el-option v-for="item in options" :key="item.deviceCode" :label="item.deviceName"
                         :value="item.deviceCode"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="输入名称" prop="name" class="mr-4">
            <el-input v-model="form.name" placeholder="请输入名称"/>
          </el-form-item>
          <el-form-item label="参数名称" prop="input">
            <el-input v-model="form.input" placeholder="参数名称模糊查询" @input="getList()"/>
          </el-form-item>
        </el-form>
        <el-table :data="tableData" border class="mt-4" height="40vh" @selection-change="handleSelectionChange"
                  ref="multipleTable">
          <el-table-column prop="parameterName" label="参数名称" align="center"></el-table-column>
          <el-table-column prop="parameterCode" label="参数代码" align="center"></el-table-column>
          <el-table-column prop="parameterValue" label="参数值" align="center"></el-table-column>
          <el-table-column prop="parameterValueName" label="参数值名称" align="center"></el-table-column>
          <el-table-column type="selection" width="70" align="center"></el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="onSubmit">保存</el-button>
        <el-button @click="dialogVisible = false">取消</el-button>
      </span>
    </el-dialog>

    <!-- 更新参数类型二 -->
    <twoDialog ref="twoDialog"></twoDialog>
    <!-- 更新参数类型三 -->
    <threeDialog ref="threeDialog"></threeDialog>
  </div>
</template>

<script>
  import { getToken } from "@/utils/auth"
  import { queryDeviceRealDataInfo } from "@/api/projectOverview/index"
  import {
    insertVVisualization,
    updateVVisualization,
    queryOnVVisualization,
    insertOrUpdateVVisualizationDetail,
    queryAllDeviceList,
    queryParamConfig,
    queryParamStatusConfig
  } from "@/api/chartControl/index"
  import ycDialog from "@/components/pageDialog"
  import twoDialog from "./dialog/twoDialog"
  import threeDialog from "./dialog/threeDialog"

  export default {
    components: {
      ycDialog,
      twoDialog,
      threeDialog
    },
    data() {
      return {
        form: {
          name: "",
          input: "",
          deviceVal: "" //选择设备值
        },
        oneVisible: false,
        dialogVisible: false,
        options: [], //选择设备下拉框
        tableData: [], //表格数据
        headers: {
          token: getToken()
        },
        upload: "/uploadManager/upload", //上次图片接口路径
        downPic: "", //图片路径
        detailsDisabled: false,
        screenForm: {
          //新增大屏数据
          name: "",
          picCode: ""
        },
        screenRules: {},
        setId: {}, //布局信息
        setNum: null, //当前配置组件位置（数字）
        showList: [], //配置布局时弹窗可展示的组件数据
        currentlySet: "", //当前配置组件位置（英文）
        topSides: [22, 23], //顶部可选择的组件id
        centerBottom: [19, 20, 21], //中间下方可选择的组件id
        centerTop: [1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14], //中间上方可选择的组件id
        leftRight: [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 16, 17, 18], //左右两侧可选择的组件id
        picList: [
          { id: 1, code: "ZJ_ZX_ONE", type: 1 },
          { id: 2, code: "ZJ_ZX_TWO", type: 1 },
          {
            id: 3,
            code: "ZJ_ZZ_ONE",
            type: 1
          },
          { id: 4, code: "ZJ_ZZ_TWO", type: 1 },
          { id: 5, code: "ZJ_BT_ONE", type: 1 },
          {
            id: 6,
            code: "ZJ_BT_TWO",
            type: 1
          },
          { id: 7, code: "ZJ_TX_ONE", type: 1 },
          { id: 8, code: "ZJ_TX_TWO", type: 1 },
          {
            id: 9,
            code: "ZJ_BFB_ONE_S_SM",
            type: 2,
            num: 2
          },
          { id: 10, code: "ZJ_BFB_TWO_S_BIG", type: 2, num: 6 },
          {
            id: 11,
            code: "ZJ_BFB_ONE_B_SM",
            type: 2,
            num: 2
          },
          { id: 12, code: "ZJ_BFB_TWO_B_BIG", type: 2, num: 6 },
          {
            id: 13,
            code: "ZJ_STATUS_SM",
            type: 3,
            num: 7
          },
          { id: 15, code: "ZJ_TX_THREE", type: 3, num: 3 },
          { id: 16, code: "ZJ_FOUR", type: 3, num: 4 },
          {
            id: 17,
            code: "ZJ_SIX",
            type: 3,
            num: 6
          },
          { id: 18, code: "ZJ_NINE", type: 3, num: 9 },
          { id: 19, code: "ZJ_TABLE_ONE" },
          {
            id: 20,
            code: "ZJ_TABLE_TWO"
          },
          { id: 22, code: "ZJ_HEAD_ONE", type: 3, num: 3 },
          { id: 23, code: "ZJ_HEAD_TWO" }
        ], //组件数据
        type: this.$route.query.type, //更新布局或参数
        configCode: this.$route.query.configCode ? this.$route.query.configCode : "", //大屏信息编号
        addScreenForm: {
          //大屏信息
          visualizationName: this.$route.query.visualizationName ? this.$route.query.visualizationName : "",
          downPic: this.$route.query.downPic ? this.$route.query.downPic : "",
          visualizationType: this.$route.query.visualizationType ? this.$route.query.visualizationType : ""
        },
        multipleSelection: [],
        oneList: []
      }
    },
    created() {
      if (this.$route.query.id) {
        this.getInfo()
      }
      this.getOptions()
    },
    methods: {
      //获取下拉框数据
      getOptions() {
        queryAllDeviceList().then((res) => {
          this.options = res.object
        })
      },
      //获取列表数据
      getList() {
        if (this.form.deviceVal == "") return false
        queryDeviceRealDataInfo({
          deviceCode: this.form.deviceVal,
          messages: this.form.input
        }).then((res) => {
          this.tableData = res.object
          this.$refs.multipleTable.clearSelection()
        })
      },
      //获取布局配置信息
      getInfo() {
        queryOnVVisualization({
          configCode: this.$route.query.configCode
        }).then((res) => {
          this.addScreenForm.downPic = res.object.downPic
          res.object.setInfo.forEach((ele) => {
            Object.keys(ele).forEach((key) => {
              if (ele[key].name != "") this.$set(this.setId, key, ele[key])
            })
          })
        })
      },
      //表格勾选
      handleSelectionChange(val) {
        if (val.length > 1) {
          this.$refs.multipleTable.clearSelection()
          this.$refs.multipleTable.toggleRowSelection(val.pop())
        }
        this.multipleSelection = val.map((item) => {
          return {
            parameterCode: item.parameterCode,
            parameterName: item.parameterName
          }
        })
      },
      beforeUpload(file) {
        const fileFamart = file.name.split(".")[file.name.split(".").length - 1]
        const suffix = fileFamart === "jpg"
        const suffix2 = fileFamart === "png"
        const suffix3 = fileFamart === "jpeg"
        if (!suffix && !suffix2 && !suffix3) {
          this.$message.warning("只能上传图片格式的文件!")
          return false
        }
        return suffix || suffix2 || suffix3
      },
      //上传图片
      handleLicenseSuccess(id, file) {
        this.addScreenForm.downPic = file.response.object.url
        this.downPic = file.response.object.url
      },
      //新增大屏
      addClick() {
        insertVVisualization(this.addScreenForm).then((res) => {
          if (res.status == 200) {
            this.$message({
              type: "success",
              message: res.message
            })
            this.configCode = res.object
          }
        })
      },
      onDel(data) {
        this.$confirm("确定删除该条数据?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          let index = this.oneList.indexOf(data)
          if (index > -1) this.oneList.splice(index, 1)
          this.$message({
            type: "success",
            message: "删除成功!"
          })
        })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除"
            })
          })
      },
      addItem() {
        this.form = {
          name: "",
          deviceVal: ""
        }
        this.tableData = []
        this.dialogVisible = true
      },
      onSubmit() {
        if (this.multipleSelection.length == 0) return this.$message.error("请选择数据！")
        // let url = ""
        // this.multipleSelection.map((item, index) => {
        //   if (index == 0) {
        //     url += item
        //   } else {
        //     url += "&" + item
        //   }
        // })
        let obj = {
          deviceCode: this.form.deviceVal,
          deviceName: this.options.find((ele) => ele.deviceCode == this.form.deviceVal).deviceName,
          parameterCode: this.multipleSelection[0].parameterCode,
          parameterName: this.multipleSelection[0].parameterName
        }
        this.oneList.push(obj)
        this.dialogVisible = false
      },

      //更新参数保存
      onSave() {
        if (this.oneList.length == 0) return this.$message.error("请添加数据！")
        let obj = {
          tkType: 1,
          configCode: this.configCode,
          partIndex: this.setNum,
          items: this.oneList
        }
        obj = JSON.stringify(obj)
        insertOrUpdateVVisualizationDetail({ items: obj }).then((res) => {
          this.$message({
            type: "success",
            message: res.message
          })
          this.oneVisible = false
        })
      },

      //点击配置
      openConfigDialog(index, side, num) {
        if (this.configCode == "") return this.$message.error("请先输入大屏标题、上传图片并且点击保存！")
        this.currentlySet = index
        this.setNum = num
        if (this.type == 1) {
          Object.keys(this.setId).forEach((key) => {
            if (key == this.currentlySet) {
              let i = this.picList.findIndex((item) => item.code == this.setId[key].picCode)
              if (this.picList[i].type == 1) {
                queryParamConfig({
                  configCode: this.configCode,
                  index: num,
                  partType: this.picList[i].code
                }).then(res => {
                  if (res.status == 200) {
                    this.oneList = res.object
                    this.oneVisible = true
                  }
                })
              } else if (this.picList[i].type == 2) {
                queryParamConfig({
                  configCode: this.configCode,
                  index: num,
                  partType: this.picList[i].code
                }).then(res => {
                  if (res.status == 200) {
                    this.$refs.twoDialog.bfbItems = res.object
                    let tabLists = []
                    for (let x = 1; x <= this.picList[i].num; x++) {
                      tabLists.push(x.toString())
                    }
                    this.$refs.twoDialog.tabList = tabLists
                    this.$refs.twoDialog.options = this.options
                    this.$refs.twoDialog.configCode = this.configCode
                    this.$refs.twoDialog.partIndex = this.setNum
                    this.$refs.twoDialog.handleClick()
                    this.$refs.twoDialog.dialogVisible = true
                  }
                })
              } else if (this.picList[i].type == 3) {
                queryParamConfig({
                  configCode: this.configCode,
                  index: num,
                  partType: this.picList[i].code
                }).then(res => {
                  if (res.status == 200) {
                    this.$refs.threeDialog.items = res.object
                    let tabList = []
                    for (let a = 1; a <= this.picList[i].num; a++) {
                      tabList.push(a.toString())
                    }
                    this.$refs.threeDialog.tabList = tabList
                    this.$refs.threeDialog.options = this.options
                    this.$refs.threeDialog.configCode = this.configCode
                    this.$refs.threeDialog.partIndex = this.setNum
                    this.$refs.threeDialog.editAndShow()
                    this.$refs.threeDialog.dialogVisible = true
                  }
                })
              }
            }
          })
        } else {
          this[side].forEach((ele) => {
            this.picList.forEach((item) => {
              if (item.id == ele) this.showList.push(item)
            })
          })
          this.$refs.ycDialog.dialogVisible = true
        }
      },

      // 更新布局保存
      configBtn() {
        if (this.screenForm.name == "" || this.screenForm.picCode == "") return this.$message.error("请输入名称并且选择配置！")
        let form = {
          configCode: this.configCode,
          index: this.setNum,
          partName: this.screenForm.name,
          partType:
            this.screenForm.picCode == "ZJ_TABLE_ONE" ||
            this.screenForm.picCode == "ZJ_TABLE_TWO" ||
            this.screenForm.picCode == "ZJ_TABLE_THREE" ||
            this.screenForm.picCode == "ZJ_HEAD_TWO"
              ? "N"
              : "Y",
          partCode: this.screenForm.picCode
        }
        updateVVisualization(form).then((res) => {
          if (res.status == 200) {
            this.$message({
              type: "success",
              message: res.message
            })
            let obj = {
              name: this.screenForm.name,
              picCode: this.screenForm.picCode
            }
            this.$set(this.setId, this.currentlySet, obj)
            this.onClose()
          }
        })
      },

      //弹窗关闭
      onClose() {
        this.screenForm = {
          name: "",
          picCode: ""
        }
        this.showList = []
        this.tableData = []
        this.$refs.ycDialog.dialogVisible = false
      },
      returnUrl() {
        this.$router.go(-1)
      }
    }
  }
</script>

<style lang="scss" scoped>
  .imgCla {
    display: inline-block;
    width: 50px;
    height: 30px;
    vertical-align: middle;
  }

  ::v-deep .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }

  .bg {
    width: 100%;
    height: 100%;
    padding: 5.1% 2.5% 2.5% !important;
    background-image: url('../../../../assets/img/screen/screenBg.png');
    background-size: 100% 100%;
    background-position: center center;

    .screen_content {
      height: 100%;
      width: 100%;

      .left {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        width: 23%;
      }

      .center {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        width: 52%;
        margin: 0 1%;

        .center_top {
          width: 100%;
          height: 18%;
          border: 1px solid #16d0ff;
          position: relative;
        }

        .center_content {
          width: 100%;
          height: 38%;

          .centerContentItem {
            width: 49%;
            height: 100%;
            border: 1px solid #16d0ff;
          }

          .mr {
            margin-right: 2%;
          }
        }
      }

      .right {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        width: 23%;
      }
    }
  }

  .boxItem {
    height: 23.5%;
    /*margin-bottom: 3%;*/
    border: 1px solid #16d0ff;
  }

  .title {
    height: 30px;
    line-height: 30px;
    border-bottom: 1px solid;
    /*background-color: #0063A1;*/
    padding-left: 12px;
    color: #ffffff;
    background: linear-gradient(88deg, #0063a1 0%, rgba(1, 99, 161, 0) 100%);
    border-image: linear-gradient(89deg, #16d0ff 0%, rgba(22, 208, 255, 0) 100%) 1 1;
  }

  .configContent {
    height: calc(100% - 30px);
    position: relative;
  }

  .setBut {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 199;
  }

  .f_center {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  ::v-deep .el-input__inner {
    width: 200px !important;
  }

  ::v-deep .el-radio__label {
    display: none;
  }

  ::v-deep .el-form-item {
    margin-bottom: 0px !important;
  }

  .my_img {
    width: 100%;
    height: 100%;
  }

  .my_span {
    width: 70px;
    text-align: right;
    vertical-align: middle;
    float: left;
    font-size: 14px;
    color: #606266;
    line-height: 40px;
    padding: 0 12px 0 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    font-weight: 600;
  }

  .my_dialog {
    ::v-deep .el-dialog {
      border-radius: 8px;

      .el-dialog__headerbtn {
        // 叉号样式
        font-size: 30px;
      }

      .el-dialog__header {
        background: #e6e6e6;
        border-bottom: 1px solid #cccccc;
        border-radius: 8px 8px 0 0;
      }

      .el-dialog__headerbtn {
        font-size: 20px;
      }
    }
  }

  .dialog-footer {
    display: flex;
    justify-content: center;
  }
</style>
